package treeview.unit;

import document.Context;

import java.awt.*;

/**
 * Created by Pavel Nikolaev
 */
public final class ListMarkView extends ContextDependentView {
    private String myMark;

    public ListMarkView(int number, Context context) {
        super(context);
        myMark = (number != 0) ? String.valueOf(number) : "*";
    }

    public void fitIntoWidth(Graphics g, int widthToFitInto) {
        myWidth = myContext.getListIndentWidth();
        myHeight = g.getFontMetrics(myContext.getFont()).getHeight();
    }

    public void paint(Graphics g) {
        int mark_x = myX + myWidth /2;
        int mark_y = myY + myAscent;
        g.drawString(myMark, mark_x, mark_y);
    }
}
